<?php
/*
 *---------------------------------------------------------------------------
 *
 *                  T E N C E N T   P R O P R I E T A R Y
 *
 *     COPYRIGHT (c)  2008 BY  TENCENT  CORPORATION.  ALL RIGHTS
 *     RESERVED.   NO  PART  OF THIS PROGRAM  OR  PUBLICATION  MAY
 *     BE  REPRODUCED,   TRANSMITTED,   TRANSCRIBED,   STORED  IN  A
 *     RETRIEVAL SYSTEM, OR TRANSLATED INTO ANY LANGUAGE OR COMPUTER
 *     LANGUAGE IN ANY FORM OR BY ANY MEANS, ELECTRONIC, MECHANICAL,
 *     MAGNETIC,  OPTICAL,  CHEMICAL, MANUAL, OR OTHERWISE,  WITHOUT
 *     THE PRIOR WRITTEN PERMISSION OF :
 *
 *                        TENCENT  CORPORATION
 *
 *       Advertising Platform R&D Team, Advertising Platform & Products
 *       Tencent Ltd.
 *---------------------------------------------------------------------------
 */

/**
 * The util class
 *
 * @package lib.util
 * @author  ianzhang <ianzhang@tencent.com>
 * @version TMUtil.class.php 2008-9-6 by ianzhang
 */
class JYUtil {
    /**
     * Strip slashes recursively from array
     *
     * @param  array $value  the value to strip
     * @return array clean value with slashes stripped
     */
    public static function stripslashesDeep($value) {
        return is_array ( $value ) ? array_map ( array ('JYUtil', 'stripslashesDeep' ), $value ) : stripslashes ( $value );
    }

    /**
     * Filter text recursively from array
     *
     * @access public
     * @param  mixed $value     the value to filter text
     * @return mixed  $result   clean value with filtered
     */
    public static function filterTextDeep($value) {
        return is_array($value)?array_map(array("JYUtil", "filterTextDeep"), $value) : JYFilterUtils::filterText($value,false);
    }

    /**
     * 处理query字符串，例如a=b&c=d
     *
     * @param  string $string     处理源字符串
     * @return array $resultArray       结果数组
     */
    public static function handleQueryString($string) {
        $resultArray = array();
        if(parse_str($string, $resultArray)) {
            return $resutlArray;
        }
        return array();
    }
}
